<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <meta name="format-detection" content="telephone=no" />
    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
    <meta http-equiv="Pragma" content="no-cache" />
    <meta http-equiv="Expires" content="0" />
    <link rel="stylesheet" href="stylesheets/zui.min.css"/>
    <link rel="stylesheet" href="stylesheets/main.css" id="css"/>
    <script src="javascripts/jquery-1.10.1.min.js"></script>
     <script src="javascripts/main.js"></script>
    <script src="javascripts/tool.js"></script>
    <script src="javascripts/footer.js"></script>
    <title>斯迈普解盘侠</title>
    <script>
    	$(function(){
    		$('.login').click(function(){
    			var code = $('input[name="code"]').val();
    			var pwd = $('input[name="pwd"]').val();
    			$.ajax({
//     				url:'http://localhost:8080/tpartner-wx/authen/login.do?code=13909090909&pwd=123456',
    				url:'../authen/login.do',
    				type:'post',
    				data:{code:code,pwd:pwd},
    				dataType:'json',
    				success:function(d){
    					if(d.success){
    						console.log('login.html --> d.data = '+d.data);
    						if(window.localStorage){
var userInfo = {code:code,pwd:pwd,nick:d.data.nick,mphone:d.data.mphone,email:d.data.email,permissions:[],roles:[],ulist:d.data.ulist,_loginStatus:true,_loginStatus:true};
    							console.log('userInfo = '+userInfo);
    							
    							initUserInfo(function(data){
    								userInfo.permissions = data.data.permissions;
    								userInfo.roles = data.data.roles;
    								var userInfoStr = JSON.stringify(userInfo); 
    								window.localStorage.setItem('userInfo',userInfoStr);
    								var fromUrl = getSearchParam('redirectUrl');//是从fromUrl来到登录界面的，所以fromUrl应该设置
    								if(fromUrl != null && fromUrl != ''){
    		    						window.location.href = fromUrl;
    	    						} else {//如果找不到上一张页面，则做浏览器退页操作
    	    							window.location.href = 'index.html';
    	    							/* history.go(-1);
    	    							location.reload(); */
    	    						}
    							});
    							
    						}
    						
    					} else {
    						$('.loginMsg').text('用户名或密码错误');
    					}
    				}
    			});
    		});
    		
    		/**
    			注册按钮事件绑定
    		*/
    		$('.registBtn').click(function(){
    			window.location.href = 'register.html';
    		});
    		
    		/**
    			密码找回按钮
    		*/
    		$('.retrievePwdBtn').click(function(){
    			window.location.href = 'find-pwd.html';
    		});
    	});
    </script>
</head>
<body class="index">
    <div class="container main">
        <div class="row login-box">
            <div class="login-box-row">
                   <span>账户</span>
                    <input type="text" name="code" placeholder="手机号"/>
            </div>
            <div class="login-box-row no-border">
                <span>密码</span>
                <input type="password" name="pwd" placeholder="请输入登陆密码"/>
            </div>
        </div>

        <div class="row login-btn-box">
            <div class="col-xs-12">
                <button class="btn btn-danger login">登陆</button>
            </div>
        </div>

        <div class="row forget-box">
            <div class="col-xs-12">
                <span class="retrievePwdBtn">忘记密码</span>
            </div>
        </div>

        <div class="row register-btn-box">
            <button class="btn registBtn">免费注册</button>
        </div>
        <div class="row register-btn-box">
            <label class="loginMsg" style="color:red;"></label>
        </div>

       <footer class="nav-footer">
			<div class="col-xs-3" id="hall" >
				<i class="icon icon-home"></i>
				<h4>解盘</h4>
			</div>
			<div class="col-xs-3" id="notify"  >
				<i class="icon icon-volume-up"></i>
				<h4>喊单</h4>
			</div>
			<div class="col-xs-3" id= "news" >
				<i class="icon icon-globe"></i>
				<h4>资讯</h4>
			</div>
			<div class="col-xs-3  footer-nav-active" id="my" >
				<i class="icon icon-user"></i>
				<h4>个人中心</h4>
			</div>
	</footer>
    </div>
   
</body>
</html>